package com.ransj.ndkpath.common;

import com.ransj.ndkpath.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;

/**
 * 
 * @author w
 * 
 */
public abstract class ChildActivity extends Activity implements OnItemClickListener{
	protected String mNameArray[];
	private BaseAdapter mAdapter;
	private ListView mList;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		initData();
		setContentView(R.layout.page_childactivity);
		mList = (ListView) findViewById(R.id.child_activity_list);
		mAdapter = new ArrayAdapter<String>(this, R.layout.item_child_activity, R.id.item_child_activity_name, mNameArray);
		mList.setAdapter(mAdapter);
		mList.setOnItemClickListener(this);
	}

	@Override
	protected void onResume() {
		super.onResume();
	}

	@Override
	protected void onPause() {
		super.onPause();
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
	}
	
	

	@Override
	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
		onItemClick(arg2);
	}

	protected abstract void initData();

	protected abstract void onItemClick(int index);

}
